package com.itrip.biz.service.impl;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.itrip.beans.pojo.User;
import com.itrip.biz.service.UserService;
import com.itrip.dao.UserMapper;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 用户表 服务实现类
 * </p>
 *
 * @author 周勉
 * @since 2020-02-28
 */
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {

    @Override
    public User login(User user) {
        QueryWrapper<User> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("user_code", user.getUserName()).eq("user_password", user.getUserPassword());
        User sysuser = baseMapper.selectOne(queryWrapper);
        if (sysuser != null) {
            return sysuser;
        }
        return null;
    }
}
